package com.hmdp.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hmdp.content.MessageContent;
import com.hmdp.domain.dto.LoginFormDTO;
import com.hmdp.domain.dto.Result;
import com.hmdp.domain.entity.User;
import org.springframework.validation.annotation.Validated;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import javax.validation.constraints.Pattern;

import static com.hmdp.utils.RegexPatterns.PHONE_REGEX;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@Validated
public interface IUserService extends IService<User> {
    /**
     * 短信验证
     * @param phone
     * @return
     */
    Result sendcode(@Pattern(regexp = PHONE_REGEX, message = MessageContent.PHONE_ERROR)String phone );

    /**
     * 账号登录/注册
     * @param loginForm
     * @param session
     * @return
     */

    Result login(@Valid LoginFormDTO loginForm, HttpSession session);

    Result sign();

    Result logout(HttpServletRequest request);
}
